package codingforgreat.lchot150;

public class Lc191 {
    public int hammingWeight(int n) {
        int res = 0;
        int righrOne = 0;
        while(n != 0){
            res++;
            righrOne = n & (-n);
            n -= righrOne;
        }
        return res;

    }
}
